import React, {FC, useEffect} from "react";

import {useNavigate, Link} from "react-router-dom";
import {Button, Typography} from "antd";
import {MANAGE_INDEX_PATH} from "../router";
import styles from "./Home.module.scss"
import '../_mock/index'

import axios from "axios";

const {Title, Paragraph} = Typography

const Home: FC = () => {
    const nav = useNavigate()
    useEffect(() => {
        // fetch('/api/test').then(res => res.json()).then(data => console.log(data));
        axios.get('/api/test').then(res => console.log(res.data))
    }, [])


    function clickHandler() {
        nav('/login')
    }

    return (
        <div className={styles.container}>
            <div className={styles.info}>
                <Title>问卷调查 | 在线投票</Title>
                <Paragraph>
                    一个简单好用的问卷系统
                </Paragraph>
                <div>
                    <Button type="primary" onClick={() => nav(MANAGE_INDEX_PATH)}>
                        开始使用
                    </Button>
                </div>
            </div>
        </div>
    )
}

export default Home